package com.hghivln.erpwarehouse.system.mapper;

import com.hghivln.erpwarehouse.system.entity.Dept;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hghivln
 * @since 2021-06-27
 */
public interface DeptMapper extends BaseMapper<Dept> {

    /**
     * 查询最大的排序码
     */
    @Select("select max(ordernum) from sys_dept")
    Integer queryDeptMaxOrderNum();

    /**
     * 根据ID查询当前部门的子部门的个数
     */
    @Select("select count(1) from sys_dept where pid=#{id}")
    Integer getDeptChildrenCountById(Integer id);
}
